// create an axios instance
import axios from 'axios'
import ip2 from '@/components/ip2'
const request = axios.create({
    baseURL: ip2, // url = base url{ + request url
    // withCredentials: true, // send cookies when cross-domain requests
    timeout: 500000 // request timeout
})
// 添加请求拦截器，在请求头中加token
request.interceptors.request.use(
    config => {
        if (localStorage.getItem('Authorization')) {
            config.headers.Authorization = localStorage.getItem('Authorization');
        }
        return config;
    },
    error => {
        return Promise.reject(error);
    });

export default request
